import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'

Vue.config.productionTip = false

import http from './http'
Vue.prototype.$http = http

Vue.mixin({
  data() {
    return {
      dialogWidth: 0
    }
  },
  computed: {
    uploadUrl() {
      return this.$http.defaults.baseURL + 'upload'
    },
    picUrl() {
      return 'http://localhost:3000'
    }
  },
  methods: {
    getAuthHeaders() {
      return {
        Authorization: `Bearer ${localStorage.token || ''}`
      }
    },
    setDialogWidth() {
      var val = document.body.clientWidth;
      const def = 1000; // 默认宽度
      if (val < def) {
        this.dialogWidth = "100%";
      } else {
        this.dialogWidth = def + "px";
      }
    },
  }
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')